use libc;
use std::ffi;
fn main() {
    unsafe {
        let pid = libc::fork();
        if pid > 0 {
            println!("Parent[{}]: {pid}", libc::getpid());
        } else if pid == 0 {
            println!("Child[{}]: {}", libc::getpid(), libc::getppid());
        } else {
            println!(
                "Error: {}",
                ffi::CString::from_raw(libc::strerror(*libc::__errno_location()))
                    .into_string()
                    .unwrap()
            );
        }
    }
}
